home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 2002
- // Author: DRB
- //
- // Description: Create and attach a glow shape to a volumeLight
- //
-
- global proc string initVolumeLightFog( string $tform, string $shape )
- {
- string $glowShape = "";
- // create a shape node for the light fog based on the light's shape
- int $lightShape = `getAttr ($shape + ".lightShape")`;
- if( $lightShape == 1 ){ // sphere
- $glowShape = `createNode renderSphere`;
- } else if( $lightShape == 3 ){ // cone
- $glowShape = `createNode renderCone`;
- } else { // cylinder && box
- $glowShape = `createNode renderBox`;
- }
- if( $glowShape != "" ){
- setAttr ($glowShape + ".renderType") 1;
- setAttr ($glowShape + ".overrideEnabled") 1;
- // Use the "reference" display override to avoid confusion
- // due to the pickable glow shape overlapping the volume light shape.
- setAttr ($glowShape + ".overrideDisplayType") 2;
- connectAttr ($glowShape + ".message") ($shape + ".fogGeometry");
- string $tf[] = `listTransforms $glowShape`;
- string $glowTform = $tf[0];
- if( $lightShape == 3 ){ // cone
- setAttr ($glowShape + ".coneAngle") 90;
- setAttr ($glowShape + ".coneCap") 1;
- setAttr ($tf[0] + ".rotateX") -90;
- }
- // Moving the shape just inside the light shape bounds avoids
- // a render precision problem that results in black
- // boxy artifacts in the glow. -DB
- setAttr ($glowTform + ".scaleX") 0.999;
- setAttr ($glowTform + ".scaleY") 0.999;
- setAttr ($glowTform + ".scaleZ") 0.999;
- parent -r $glowTform $tform;
- }
-
- return $glowShape;
- }
-